﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Oracle.DataAccess.Client;
using System.Windows.Forms;

namespace DBtuning
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            LabelTest.Text = "start connect....";
            try
            {
                OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["OracleConnection"].ConnectionString);
                con.Open();
                string inf = con.ServerVersion;
                LabelTest.ForeColor = System.Drawing.Color.Green;
                LabelTest.Text = "Connected! Version:" + inf;
                con.Close();
            }
            catch (OracleException ex)
            {
                LabelTest.ForeColor = System.Drawing.Color.Red;
                LabelTest.Text = "Connection error! Error message: " + ex.Message;
            }
            catch (Exception ex)
            {
                LabelTest.ForeColor = System.Drawing.Color.Red;
                LabelTest.Text = "<b>Test Failed!</b>\r\nError Message: " + ex.Message;
            }
        }
    }
}
